package com.lu.controller;

import com.lu.entity.Blog;
import com.lu.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created by lulu on 2017/8/30.
 */
@RequestMapping("admin")
@Controller
public class BlogAdmin {
    @Autowired
    AdminService adminService;

    @RequestMapping("write.html")
    public String writePage(){
        return "add";
    }

    @RequestMapping(value = "addblog", method = RequestMethod.POST)
    public void addBlog(Blog blog) {
        adminService.addBlog(blog);
    }

    @RequestMapping("updateblog")
    public void updateBlog(Blog blog) {
        adminService.update(blog);
    }

    @RequestMapping("deleteblog")
    public void delete(int id) {
        adminService.delete(id);
    }
    @RequestMapping("findback")
    public void findBack(int id){
        adminService.findBack(id);
    }
}
